1. Field of the Invention
Embodiments of the present invention generally relate to computer graphics, and more particularly to clipping graphics primitives.
2. Description of the Related Art
Conventional graphics processors are exemplified by systems and methods developed to clip graphics primitives prior to performing setup and rasterization. Although there are some rasterizers that do not require clipping, these rasterizers are more complex than conventional rasterizers and require greater numerical precision to properly rasterize the graphics primitives.
Prior to clipping, each vertex, in object space, represented by coordinates (X,Y,Z) is converted into homogeneous space, resulting in a vertex represented by coordinates (x,y,z,w). Each graphics primitive defined by a set of vertices, e.g., three vertices define a triangle, is clipped by as many as six clipping planes to satisfy the following constraints:−w≦x≦w −w≦y≦w −w≦z≦w. As a result of this clipping, when the vertices are projected into non-homogeneous space by dividing each vertex by w, each of the projected coordinates (x,y,z) is a value ranging between −1 and 1, inclusive.
FIG. 1 illustrates a prior art orthographically projected graphics primitive 110 requiring clipping against two clipping planes, a clipping plane 111 corresponding to the +x axis and a clipping plane 112 corresponding to the +y axis. Each graphics primitive may need to be clipped to as many as six clipping planes corresponding to the −x, +x, −y, +y, −z, and +z axes to produce a clipped graphics primitive lying in a volume defined by those axes. Graphics primitive 110 is defined by vertices 100, 101, and 102, corresponding to homogeneous coordinates (−0.5, 0, 0, 1), (2, 1.5, 0, 1), and (0, 1.5, 0, 1), respectively. Vertex 101 is replaced by new vertices 103 and 104, corresponding to homogeneous coordinates (1, 0.9, 0, 1) and (1, 1.5, 0, 1), respectively, when graphics primitive 110 is clipped by clipping plane 111. Graphics primitive 110 is also clipped by clipping plane 112, generating two more new vertices to replace vertex 102 and new vertex 104. Graphics primitive 110 is clipped by two of the six clipping planes. Each clipping operation is computationally intensive, so hardware may only be provided for clipping against one or two clipping planes, causing clipping against more planes to decrease graphics processing performance.
Accordingly, there is a desire to clip graphics primitives prior to rasterization, but to only clip each graphics primitive to a single plane.